package com.zb.kl.controller;

import com.zb.kl.domain.agent.*;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/.well-known")
public class AgentCardController {
    @GetMapping(value = "/agent.json", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<AgentCard> getAgentCard() {
        AgentCard agentCard = new AgentCard();
        agentCard.setName("TicketQueen : Ticket Booking Agent");
        agentCard.setDescription("book your airlines ticket, hotel ticket, and train ticket , also find out the preference of food of a person");
        agentCard.setUrl("http://localhost:8090/kl-dt-a2a"); //  Replace with actual URL
        agentCard.setProvider(new AgentProvider("Ticket Corp", "https://github.com/vishalmysore/choturobo"));
        agentCard.setVersion("1.0.0");
        agentCard.setDocumentationUrl("https://github.com/vishalmysore/Tools4AI");  // Replace
        agentCard.setCapabilities(new AgentCapabilities(true, false, false));
        agentCard.setAuthentication(new AgentAuthentication(List.of("Bearer")));
        agentCard.setDefaultInputModes(List.of("text/plain"));
        agentCard.setDefaultOutputModes(List.of("application/json"));

        AgentSkill foodPreferenceSkill = new AgentSkill();
        foodPreferenceSkill.setId("food-preference");
        foodPreferenceSkill.setName("Food Preference");
        foodPreferenceSkill.setDescription("Provide food preference of a person");
        foodPreferenceSkill.setTags(List.of("food", "food preference", "favorite food"));
        foodPreferenceSkill.setExamples(List.of("what does the james like to eat?", "what is the food preference of this person?"));
        foodPreferenceSkill.setInputModes(List.of("application/json")); //override
        foodPreferenceSkill.setOutputModes(List.of("application/json"));

        AgentSkill bookTicketSkill = new AgentSkill();
        bookTicketSkill.setId("book-ticket");
        bookTicketSkill.setName("Book Ticket");
        bookTicketSkill.setDescription("Book an airline ticket");
        bookTicketSkill.setTags(List.of("travel", "airline", "booking"));
        bookTicketSkill.setExamples(List.of("Book a flight from New York to Los Angeles on 2024-05-10"));
        bookTicketSkill.setInputModes(List.of("application/json")); //override
        bookTicketSkill.setOutputModes(List.of("application/json"));

        AgentSkill[] sk = new AgentSkill[2];
        sk[0] = foodPreferenceSkill;
        sk[1] = bookTicketSkill;

        agentCard.setSkills(List.of(sk));

        return ResponseEntity.ok(agentCard);
    }
}
